-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add Docker Support for Easy Installation and Deployment #4559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.x
Are you sure you want to change the base?
Conversation
This commit introduces complete Docker support for Cachet v3, making installation and deployment significantly easier for users. Features: - Production-ready Dockerfile with PHP 8.3, Nginx, and all dependencies - Docker Compose orchestration with MySQL 8.0 and Redis 7 - Optimized configurations for security and performance - Comprehensive documentation with setup instructions - Health checks and proper service dependencies - Internal network security (no exposed database ports) Benefits: - One-command deployment: `docker-compose up -d --build` - Consistent environment across dev/staging/production - Eliminates complex manual setup procedures - Production-ready with security best practices - Easy scaling and container orchestration ready Files added: - Dockerfile: Multi-stage production build - docker-compose.yml: Complete service orchestration - .env.docker.example: Environment template - DOCKER.md: Comprehensive setup documentation - docker/: Configuration files for Nginx, PHP, and Supervisor
@egelhaus this is great, thank you! Cachet 2.x previously had all Docker stuff located in the |
Good, it can be done both ways. I personally prefer to have it all together in the same repo. Basically, you can pass test with docker, basing commits or pull requests with github actions, from any branch. You know if it works or not. Also for me the most important thing, if you want them to use your software, the easier the better. |
Hey @jbrooksuk , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An pre-built docker image via GitHub CI pushed to GHCR would also make sense.
As a software developer, I also prefer having everything in the same repository as the software. But from the perspective of a non-developer or a system administrator, what would I want to do with the source code? In that case, I’d rather have a clean repository containing just a docker-compose.yml and a Kubernetes deployment file. I also prefer using a pre-built image. Today, I cleaned up my PR a bit because it still had some old commits from version 2.4. My preference is to keep the webserver, scheduler, and workers separate so that in larger deployments (with many subscribers), you can scale out by running multiple workers. The scheduler is separated because artisan schedule:run should only run on a single container to avoid duplicate task execution. Ultimately, you’ll also want to create templates for Portainer, Coolify, etc., and that’s why having a separate repository is more practical than trying to cram everything into one. |
Great work on this PR — the Docker setup is clean and will make running Cachet much easier. One idea you might consider for deployments that want stricter role separation (compose/Kubernetes): split the current entrypoint.sh into smaller, role-specific scripts (e.g. entrypoint-web.sh, entrypoint-worker.sh, entrypoint-scheduler.sh) plus a tiny top-level entrypoint.sh that can delegate. That way, when someone wants to isolate web / workers / scheduler as separate services or pods, they can simply switch the entrypoint per service (or container) without touching the image or codebase. It also makes scaling and health checks per role more straightforward. Again, thanks for the excellent work here! |
Add Docker Support for Easy Installation and Deployment
Summary
This pull request adds comprehensive Docker support to Cachet v3, making installation and deployment significantly easier for users. The Docker setup includes a complete production-ready environment with Nginx, PHP-FPM, MySQL, and Redis.
What's Included
Core Docker Files
Dockerfile
- Production-ready multi-stage build with PHP 8.3, Nginx, and all required extensionsdocker-compose.yml
- Complete orchestration with app, database, and Redis services.env.docker.example
- Template environment file for Docker deploymentDOCKER.md
- Comprehensive documentation and setup instructionsDocker Configuration
docker/nginx/nginx.conf
- Optimized Nginx configuration for Laravel/Filamentdocker/php/cachet.ini
- PHP optimizations for productiondocker/supervisor/supervisord.conf
- Process management for Nginx, PHP-FPM, and queue workersdocker/entrypoint.sh
- Startup script with database migrations and cachingWhy Docker Support?
Features
Security Best Practices
Production Optimizations
Easy Setup
Architecture
The Docker setup uses a 3-service architecture:
All services communicate via a private Docker network with health checks ensuring proper startup order.
Benefits for Users
Testing
The Docker setup has been thoroughly tested and includes:
Documentation
Complete setup instructions are provided in
DOCKER.md
covering:Future Enhancements
This Docker foundation enables:
Conclusion
This Docker implementation makes Cachet more accessible to users by eliminating complex setup procedures. It provides a production-ready foundation that can grow from simple single-server deployments to complex orchestrated environments.
We believe this addition will significantly improve the user experience and adoption of Cachet v3.
Files Changed:
Dockerfile
docker-compose.yml
.env.docker.example
DOCKER.md
docker/nginx/nginx.conf
docker/php/cachet.ini
docker/supervisor/supervisord.conf
docker/entrypoint.sh